package com.jming.jike.dto.backend;

import com.jming.jike.common.ValidatorGroup.Insert;
import com.jming.jike.common.ValidatorGroup.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.math.BigDecimal;

/**
 * @author jinming.zhang
 * @version 0.0.1
 * @date 2022/04/24
 */
@Data
public class SetMealDishDTO {

    @ApiModelProperty("菜品id")
    @NotNull(message = "菜品id不能为空", groups = {Insert.class, Update.class})
    @Min(value = 1, message = "菜品id最小为{value}", groups = {Insert.class, Update.class})
    private Long id;

    @ApiModelProperty("菜品名称")
    @NotBlank(message = "菜品名称不能为空", groups = {Insert.class, Update.class})
    @Length(max = 30, message = "菜品名称不能超过{max}个字符", groups = {Insert.class, Update.class})
    private String name;

    @ApiModelProperty("菜品价格")
    @NotNull(message = "菜品价格不能为空", groups = {Insert.class, Update.class})
    @DecimalMin(message = "菜品价格不能小于0.01", value = "0.01", groups = {Insert.class,  Update.class})
    @DecimalMax(message = "菜品价格不能大于99999.99", value = "99999.99", groups = {Insert.class, Update.class})
    private BigDecimal price;

    @ApiModelProperty("菜品份数")
    @NotNull(message = "菜品份数不能为空", groups = {Insert.class, Update.class})
    @Min(value = 1, message = "菜品份数最小为{value}", groups = {Insert.class, Update.class})
    private Integer copies;

}
